import request from '@/config/axios'

// 消息记录 VO
export interface MessageVO {
  id: number // record_id
  cid: number // 问诊id
  senderId: number // 发送者id
  messageContent: string // 消息内容
  messageType: number // 消息类型：1文本，2图片，3音频，4其他
  receiverId: number // 接收方id
}

// 消息记录 API
export const MessageApi = {
  // 查询消息记录分页
  getMessagePage: async (params: any) => {
    return await request.get({ url: `/chat/message/page`, params })
  },

  // 查询消息记录详情
  getMessage: async (id: number) => {
    return await request.get({ url: `/chat/message/get?id=` + id })
  },

  // 新增消息记录
  createMessage: async (data: MessageVO) => {
    return await request.post({ url: `/chat/message/create`, data })
  },

  // 修改消息记录
  updateMessage: async (data: MessageVO) => {
    return await request.put({ url: `/chat/message/update`, data })
  },

  // 删除消息记录
  deleteMessage: async (id: number) => {
    return await request.delete({ url: `/chat/message/delete?id=` + id })
  },

  // 导出消息记录 Excel
  exportMessage: async (params) => {
    return await request.download({ url: `/chat/message/export-excel`, params })
  },
}